home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ham Radio 2000
/
Ham Radio 2000.iso
/
ham2000
/
misc
/
dbrain
/
cpu.txt
< prev
next >
Wrap
Text File
|
1996-02-12
|
5KB
|
99 lines
The DigiBrain's Brain
I think we all know a little about microprocessors and
central processing units (CPUs). These gadgets run in
computers and crunch numbers as well as driving monitors and
writing data to our printers and so on. The difference
between a microcontroller CPU and a more mainstream chip
like the Pentium or 68040 is the amount of support chips
needed. A microcontroller is often connected directly to
LEDs and switches. It needs a minimum of external parts, as
it has its own dedicated I/O ports as well as scratch RAM
and a program burned into EPROM (or EEROM.) A chip like the
Pentium needs outboard RAM, memory controllers, I/O buffers
and gobs of "glue logic" so all these components work
together properly.
Choosing a CPU
Some people get all bent out of shape over one brand of CPU
versus the other. I say, "Look at the cost and what you want
to do with it!" The Motorola 68HC705J1A family, which I
used, has some good feature--but than so do the Intel,
Zilog, Parallax and many other chips. In fact, the first
version of the DigiBrain used an old Intel 8751 and it
worked just fine! My final choice of the 68HC705J1A was (as
usual) cost, cost, cost, availability and maybe a chance to
challenge my programming skills. The version I used comes in
a skinny 20-pin package with 1.2 kbytes of EPROM and a
handful of RAM. The trick would be cramming everything into
this tiny package. Some of you are probably giving this
account the fish eye, as it seems impossible to program
anything useful in 1 kbyte of RAM, right? I mean, everyone
knows that Word 6.0 for Windows fits on a dozen 1.44-
megabyte disks. Well, just remember that the earliest home
machines, such as the Altair and Intelec8, started with 256
bytes of RAM and later moved up to a whopping 4 k. People
managed to get these machines to do all sorts of clever
stuff. The trick was careful coding in assembler! (Seeing
how long some of today's programs take to load, you might
wish that a few more people had developed that assembler
programming skill!)
Design Tools
One of the things going for the Motorola CPU was its cost.
The one-time-programmable parts are surprisingly
inexpensive. When I ordered my 68HC705J1A designer's kit, it
only set me back $99.95. I looked at the development kits
for other popular microprocessors and they all cost $200 on
up! The Motorola kit comes with an integrated
editor/assembler/debugger as well as a programmer that plugs
into your PC's serial port and a sample of the erasable
version of the part. The surprise was that the programmer
card doubles as an in-circuit emulator. A software emulator
lets you simulate a microprocessor (such as the 68HC705J1A)
in software on a different computer (such as your generic
PC)--a very useful thing to have while testing snippets of
code. Remember, though, that Motorola supplies a software
and hardware emulator. This gadget allows you to plug a
cable into your new design and run and simulate the action
of the CPU. Thus, without programming any 68HC705J1A parts
with alpha or beta versions of my program, I was able to try
routines and program the Harris DDS and so on! This also
allowed me to determine which CPU input was which on my
bungled prototype board!
I think the reason this seems so fantastic to me is that the
last chance I had to use such a device was when I was
working on a 68000-based computer. The Hewlett-Packard in-
circuit emulator I used cost our company 30+ kilodollars.
Although it was a tad fancier than the one offered by
Motorola for 99 bucks and change, the functional differences
aren't worth mentioning. As I've said before, we are indeed
living in a new golden era of designing and constructing ham
gear at home. With tools like these, new and wonderful
gadgets can be designed quite easily!
Making It Fit
At first glance, the 68HC705J1A (what a mouthful) didn't
appear to have enough I/O lines for the DigiBrain project.
Then I remembered that I was dealing with a real CPU. It was
simply a matter of using the chip's Port A as my 8-bit data
bus and turning this into two separate 8-bit ports for LCD
and DDS control. This required a set of 74ALS574 latches and
two bits from Port B--pretty good, synthesizing 16 bits from
10! To write the LCD, I send the byte to Port A and toggle
the latch bit to the LCD 74ALS574 (U3). If I want to write
to the DDS, I write my data to Port A again and toggle the
latch bit to the other 74ALS574. I also decided to use the
LCD module in 4-bit-data mode. (I had to do this because I
needed an additional three lines to control the panel.) I
suppose I could've simply added a third 74ALS574 for a third
port to control eight extra output lines. But doing so would
have raised the DigiBrain's cost and lost that "spare" I/O
line on Port B--and I can't forget Craswell's Law: Software
(once written and working, of course) is cheaper than
hardware.--WBOVNE